package com.zzy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class HelloController {

    @Autowired
    private HttpSession session;

    @GetMapping("/")
    public String index() {
        if (session.getAttribute("user") != null) {
            return "main";
        } else {
            return "login";
        }
    }


}
